package demo1225.homework;

import java.io.*;

/*
8.使用字节流完成图片的复制.(把字节读取到字节数组中)

 */
public class Demo_01 {
    public static void main(String[] args) {
        try (FileInputStream  fis = new FileInputStream("lyf.jpg");
            FileOutputStream fos = new FileOutputStream("D:\\hh.jpg")){
            byte[] bs = new byte[1024];
            int read;
            while ((read = fis.read(bs)) != -1) {
                fos.write(bs,0,read);
            }
            fos.flush();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
